#############################################################################
# $Id: x86_64-linux-icc.cmake.in 670444 2023-07-25 12:18:20Z ivanov $
#############################################################################
#############################################################################
##
##  NCBI CMake wrapper
##  ICC (version > 20.0) toolchain template

set(NCBI_PTBCFG_FLAGS_DEFINED YES)
include_guard(GLOBAL)

set(CMAKE_C_COMPILER "${CC}")
set(CMAKE_CXX_COMPILER "${CXX}")

set(CMAKE_C_FLAGS_INIT
    "-isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER} \
    -isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER}/x86_64-redhat-linux-gnu  \
    -isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER}/backward \
    -ffp-model=precise -fPIC"
)
set(CMAKE_C_FLAGS_DEBUG   "-g -O0")
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO  "-g -O3")

set(CMAKE_CXX_FLAGS_INIT
    "-isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER} \
    -isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER}/x86_64-redhat-linux-gnu \
    -isystem /opt/ncbi/gcc/${GCCVER}/include/c++/${GCCVER}/backward \
    -ffp-model=precise -fPIC"
)
set(CMAKE_CXX_FLAGS_DEBUG   "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO  "-g -O3")

set(CMAKE_EXE_LINKER_FLAGS_INIT
    "-L${LIBICC} \
    -Wl,-rpath,${LIBICC} \
    -lintlc \
    -L/opt/ncbi/gcc/${GCCVER}/lib/gcc/x86_64-redhat-linux-gnu/${GCCVER} \
    -B/opt/ncbi/gcc/${GCCVER}/lib/gcc/x86_64-redhat-linux-gnu/${GCCVER} \
    -L/opt/ncbi/gcc/${GCCVER}/lib64 \
    -Wl,-rpath,/opt/ncbi/gcc/${GCCVER}/lib64 \
    -Wl,--enable-new-dtags"
)

set(CMAKE_SHARED_LINKER_FLAGS_INIT
    "-L${LIBICC} \
    -Wl,-rpath,${LIBICC} \
    -lintlc \
    -L/opt/ncbi/gcc/${GCCVER}/lib/gcc/x86_64-redhat-linux-gnu/${GCCVER} \
    -B/opt/ncbi/gcc/${GCCVER}/lib/gcc/x86_64-redhat-linux-gnu/${GCCVER} \
    -L/opt/ncbi/gcc/${GCCVER}/lib64 \
    -Wl,-rpath,/opt/ncbi/gcc/${GCCVER}/lib64 \
    -Wl,--no-undefined"
)

#----------------------------------------------------------------------------
set(NCBI_COMPILER_FLAGS_SSE       "-msse4.2")

set(NCBI_COMPILER_FLAGS_COVERAGE  "--coverage")
set(NCBI_LINKER_FLAGS_COVERAGE     "--coverage")

set(NCBI_COMPILER_FLAGS_MAXDEBUG  "")
set(NCBI_LINKER_FLAGS_MAXDEBUG   "")

set(NCBI_LINKER_FLAGS_STATICCOMPONENTS "-static-libgcc -static-libstdc++")
